﻿#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

#include "mainwindow.h"
#include <QApplication>
#include <QSplashScreen>    //静态启动界面
#include <QMovie>   //加载gif动画显示
#include <QLabel>   //在label中载入gif动画进行显示
#include <QColor>

void showGIF(qint16 window_with,qint16 window_hight,qint16 gif_with = 640,qint16 gif_hight = 480,qint32 time = 3000)
{
    //引用资源文件
    QMovie *movie = new QMovie(":/qss/run1.gif");
    QLabel *label=new QLabel ("", 0);
    //在桌面居中显示
    label->setGeometry((window_with-gif_with)/2, (window_hight-gif_hight)/2, gif_with, gif_hight);
    label->setMovie(movie);
    label->setScaledContents(true);

    label->setWindowFlags(Qt::SplashScreen);//设置为SplashScreen, 窗口无边框,不在任务栏显示
    label->show();
    movie->start();
    QElapsedTimer t;
    t.start();
    while(t.elapsed()<time)
    {
        QApplication::processEvents();
    }
    label->close();
    delete movie;
    delete label;
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //显示gif动画
//    showGIF(1920,1080,320,240);
    MainWindow w;
    w.setWindowTitle("Designed By 香菇滑稽");
    w.setWindowFlags(Qt::WindowFlags() & ~Qt::WindowMaximizeButtonHint);
    w.show();

    return a.exec();
}
